package org.jeecg.modules.ws.service.impl;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.ws.dto.UploadSheetDataDto;
import org.jeecg.modules.ws.entity.WsBondInfo;
import org.jeecg.modules.ws.entity.WsBondProject;
import org.jeecg.modules.ws.entity.WsHblxDetail;
import org.jeecg.modules.ws.entity.WsHblxInfo;
import org.jeecg.modules.ws.mapper.WsHblxInfoMapper;
import org.jeecg.modules.ws.service.IWsHblxDetailService;
import org.jeecg.modules.ws.service.IWsHblxInfoService;
import org.jeecg.modules.ws.util.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 还本利息
 * @Author: jeecg-boot
 * @Date:   2025-03-28
 * @Version: V1.0
 */
@Service
public class WsHblxInfoServiceImpl extends ServiceImpl<WsHblxInfoMapper, WsHblxInfo> implements IWsHblxInfoService {
    @Autowired
    private IWsHblxDetailService hblxDetailService;
    @Autowired
    private ExcelUtil excelUtil;

    @Override
    public Result<?> uploadExcel(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
        List<String> list1 = new ArrayList<>();
        list1.add("bond_code");
        List<String> list2 = new ArrayList<>();
        list2.add("bond_code");
        list2.add("project_code");
        List<UploadSheetDataDto<?>> sheetDataList = new ArrayList<>();
        sheetDataList.add(new UploadSheetDataDto<WsHblxInfo>(WsHblxInfo.class, this, list1));
        sheetDataList.add(new UploadSheetDataDto<WsHblxDetail>(WsHblxDetail.class, hblxDetailService, list2));
        return excelUtil.importExcel(request, response, sheetDataList);
    }
}
